#pragma once

#include "Material.h"

class DrawContext
{
public:

	void DrawInstances(Data_RenderData::RenderData* pRenderData)
	{
		// Update transform hierarchy first

		for (cr::uint32_t iInstance = 0; iInstance < pRenderData->m_numInstances; ++iInstance)
		{
			DrawModel(pRenderData, pRenderData->m_pInstances[iInstance].m_idxModel);
		}
	}

	void DrawModels(Data_RenderData::RenderData* pRenderData) const
	{
		for (cr::uint32_t iModel = 0; iModel < pRenderData->m_numModels; ++iModel)
		{
			DrawModel(pRenderData, iModel);
		}
	}

	void DrawModel(Data_RenderData::RenderData* pRenderData, cr::uint32_t idxModel) const;

	void PushParameterBlock(gp::ParameterBlockHandle hParamBlock)
	{
		m_parameters.PushParameterBlock(hParamBlock);
	}

	void PopParameterBlock()
	{
		m_parameters.PopParameterBlock();
	}

	void SetContext(gk::ContextHandle hContext)
	{
		m_hContext = hContext;
	}

	gk::ContextHandle GetContext() const
	{
		return m_hContext;
	}

private:

	gk::ContextHandle						m_hContext;
	gp::ParameterBlockContainerFixed<16>	m_parameters;
};